package com.nandi.deviceinstall.ui.activity

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import com.bumptech.glide.Glide
import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.bumptech.glide.load.model.GlideUrl
import com.bumptech.glide.load.model.LazyHeaders
import com.bumptech.glide.request.RequestOptions
import com.nandi.deviceinstall.R
import com.nandi.deviceinstall.common.Constant
import com.nandi.deviceinstall.util.SharedTool
import kotlinx.android.synthetic.main.activity_monitor_pic.*
import kotlinx.android.synthetic.main.toolbar_back_include.*
import kotlin.math.log

class MonitorPicActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_monitor_pic)

        val path = intent.extras.getString("path")

        tv_title_toolbar.text = "设备踩点图片"

        iv_back_toolbar.setOnClickListener {
            finish()
        }
        Log.e("wl",path)
        val headers = LazyHeaders.Builder().addHeader("Authorization",
                SharedTool.get(this, Constant.TOKEN, "") as String).build()
        val requestOptions = RequestOptions().error(R.mipmap.default_image).fallback(R.mipmap.default_image)
                .placeholder(R.mipmap.default_image).diskCacheStrategy(DiskCacheStrategy.NONE).skipMemoryCache(true)
        Glide.with(this)
                .asBitmap()
                .load(GlideUrl(path, headers))
                .apply(requestOptions)
                .into(iv)
    }
}
